package errorcode

import (
	"fmt"
)

func InErr(f string, args ...any) *ErrorCode {
	return err(INTERNAL_SysErrors, f, nil, args)
}

func OpErr(f string, args ...any) *ErrorCode {
	return err(OPERATION_SysErrors, f, nil, args)
}

func ArgErr(f string, args ...any) *ErrorCode {
	return err(INVALID_ARGUMENT_ERROR_SysErrors, f, nil, args)
}

func err(errCode, f string, cause *ErrorCode, args ...any) *ErrorCode {
	return &ErrorCode{
		Code:    errCode,
		Details: fmt.Sprintf(f, args),
	}
}
